//
// Created by eng01 on 2022/8/20.
//

#include "string"
#include "vector"
#include "unordered_map"
#include "queue"

using namespace std;

/**
 * 反转字符串
 */
class Solution {
public:
    // 方法一：双指针
    void reverseString(vector<char> &s) {
        int n = s.size();
        for (int left = 0, right = n - 1; left < right; ++left, --right) {
            swap(s[left], s[right]);
        }
    }
};

int main() {
    Solution solution;
    vector<char> s = {'h', 'e', 'l', 'l', 'o'};
    solution.reverseString(s);
    for (auto &c: s) {
        printf("%c", c);
    }
    return 0;
}